package training.io;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.InputStreamReader;

public class SalinFileDemo {
	public static void main(String[] args) throws Exception {
		File input = new File("quotes.txt");
		
		InputStream in = new FileInputStream(input);
		InputStreamReader reader = new InputStreamReader(in);
		
		File output = new File("quotes-output.txt");
		FileOutputStream outstream = new FileOutputStream(output);
		
		int data;
		while((data = reader.read()) != -1){
			outstream.write(Character.toUpperCase(data));
		}
		
		// setelah pakai, jangan lupa dibereskan
		reader.close();
		in.close();
		
		outstream.close();
		
	}
}
